/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.recursos.view.utilidades;

import java.io.IOException;
import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;

/**
 *
 * @author VYG0014
 */
public class RedirectPage {    
    
    public static void redirectToPage(FacesContext ctx, String toUrl) {
        try {

            ExternalContext extContext = ctx.getExternalContext();/*
            String url = extContext.encodeActionURL(ctx.getApplication().
                    getViewHandler().getActionURL(ctx, toUrl));*/

            extContext.redirect(toUrl);
        } catch (IOException e) {
            throw new FacesException(e);
        }
    }

}
